<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>transform 画五边形和六边形</title>
    <style>
        .trapezoid {
            width: 54px;
            height: 0;
            margin: 100px auto;
            border-top: 50px solid #f00;
            border-left: 18px solid transparent;
            border-right: 18px solid transparent;
            position: relative;
        }

        .trapezoid::after {
            content: '';
            position: absolute;
            width: 0;
            height: 0;
            border-bottom: 35px solid #f00;
            border-left: 45px solid transparent;
            border-right: 45px solid transparent;
            top: -85px;
            left: -18px;
        }

        .hexagon {
            margin: 100px auto;
            width: 100px;
            height: 55px;
            background-color: #f00;
            position: relative;
        }

        .hexagon::before {
            content: '';
            position: absolute;
            width: 0;
            height: 0;
            border-bottom: 25px solid #f00;
            border-left: 50px solid transparent;
            border-right: 50px solid transparent;
            top: -25px;
        }

        .hexagon::after {
            content: '';
            position: absolute;
            width: 0;
            height: 0;
            border-top: 25px solid #f00;
            border-left: 50px solid transparent;
            border-right: 50px solid transparent;
            bottom: -25px;
        }
    </style>
</head>
<body>
    <div class="trapezoid"></div>
    <div class="hexagon"></div>
</body>
</html>